<template>
    <div>
      <h2>修改</h2>
      <table>
        <tbody>
          <tr>
            <td>房间名称</td>
            <td>
              <input type="text" v-model="form.fname" />
            </td>
          </tr>
       
       
          <tr>
            <td>状态</td>
            <td>
              <input type="text" v-model="form.zhuangtai" />
            </td>
          </tr>
          <tr>
            <td>类型</td>
            <td>
              <input type="text" v-model="form.leixing"  />
            </td>
          </tr>
          <tr>
            <td></td>
            <td>
              <button @click="Add">修改</button>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </template>
  
  <script setup lang="ts">
  import { ref, reactive, onMounted } from "vue";
  import { useRouter } from "vue-router";
  import axios from "axios";
  import "bootstrap/dist/css/bootstrap.min.css";
  
  const router = useRouter();
  
  const form = reactive({
    id: 0,
    fname: "",
    name: "",
    pwd: "",
    zhuangtai: "",
    leixing: "",
  });
  
  const Add=()=>{
      if(!form.fname){
          alert("不能为空");
          return;
      }
  
      axios.post("https://localhost:7143/api/fanghao/Addfang",form).then(res=>{
              if(res.data>0)
              {
                  alert("成功");
                  
  
              }
              else
              {
                  alert("失败");
              }
      })
  
  
  }
  
  </script>
  
  <style scoped></style>
  